﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MotionCS.Controller
{
    public class AxisConfi
    {
        /// <summary>
        /// 轴标识
        /// </summary>
        public AxisEnum Identity { get; set; }
        /// <summary>
        /// 轴名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 控制轴号
        /// </summary>
        private int axis = -1;
        public int Axis { get => axis; set => axis = value; }
        /// <summary>
        /// 限位有效电平
        /// </summary>
        public int ElLevel { get; set; }
        /// <summary>
        /// 到位输入
        /// </summary>
        private int inp = -1;
        public int Inp 
        { 
            get => inp; 
            set
            {
                inp = value % 1000;
                if (inp != -1) inpLevel = value / 1000;
            } 
        }
        /// <summary>
        /// 到位有效电平
        /// </summary>
        private int inpLevel;
        public int InpLevel { get => inpLevel; }
        /// <summary>
        /// 报警输入
        /// </summary>
        private int alm = -1;
        public int Alm
        {
            get => alm;
            set
            {
                alm = value;
                if (alm != -1) almLevel = value / 1000;
            }
        }
        /// <summary>
        /// 报警有效电平
        /// </summary>
        private int almLevel;
        public int AlmLevel { get => almLevel; }
        /// <summary>
        /// 急停输入
        /// </summary>
        private int emg = -1;
        public int Emg
        {
            get => emg;
            set
            {
                emg = value;
                if (emg != -1) emgLevel = value / 1000 ;
            }
        }
        /// <summary>
        /// 急停有效电平
        /// </summary>
        private int emgLevel;
        public int EmgLevel { get => emgLevel; }
        /// <summary>
        /// 指令脉冲输出模式
        /// </summary>
        public Int32 OutMode { get; set; }
        /// <summary>
        /// 编码器脉冲输入模式
        /// </summary>
        public Int32 IptMode { get; set; }
        /// <summary>
        /// 指令脉冲当量
        /// </summary>
        public float OutUnit { get; set; }
        /// <summary>
        /// 编码器脉冲当量
        /// </summary>
        public float IptUnit { get; set; }
        /// <summary>
        /// 起始速度
        /// </summary>
        public float StartSpeed { get; set; }
        /// <summary>
        /// 手动速度
        /// </summary>
        public float MualSpeed { get; set; }
        /// <summary>
        /// 加速度
        /// </summary>
        public float MualAccel { get; set; }
        /// <summary>
        /// 减速度
        /// </summary>
        public float MualDecel { get; set; }
        /// <summary>
        /// 自动运行速度
        /// </summary>
        public float AutoSpeed { get; set; }
        /// <summary>
        /// 加速度
        /// </summary>
        public float AutoAccel { get; set; }
        /// <summary>
        /// 减速度
        /// </summary>
        public float AutoDecel { get; set; }
        /// <summary>
        /// 回零高速
        /// </summary>
        public float HomeSpeedH { get; set; }
        /// <summary>
        /// 回零低速
        /// </summary>
        public float HomeSpeedL { get; set; }
        /// <summary>
        /// 加速度
        /// </summary>
        public float HomeAccel { get; set; }
        /// <summary>
        /// 减速度
        /// </summary>
        public float HomeDecel { get; set; }
        /// <summary>
        /// S曲线
        /// </summary>
        public float Sramp { get; set; }
        /// <summary>
        /// 回零后偏移位置
        /// </summary>
        public float HomeOffset { get; set; }
        /// <summary>
        /// 回零模式
        /// </summary>
        private Int32 homeMode = -1;
        public Int32 HomeMode { get => homeMode; set => homeMode = value; }
        /// <summary>
        /// 回零方向
        /// </summary>
        private Int32 homeDir = 0;
        public Int32 HomeDir { get => homeDir; set => homeDir = value; }
        /// <summary>
        /// 反找等待时间
        /// </summary>
        public Int32 HomeWait { get; set; }
        /// <summary>
        /// 正软限位
        /// </summary>
        public float FsLimit { get; set; }
        /// <summary>
        /// 负软限位
        /// </summary>
        public float RsLimit { get; set; }
        /// <summary>
        /// 运动方向
        /// </summary>
        public int MoveDir { get; set; }
    }
}
